/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Client.gui;

import Client.domain.ClientDomainController;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import javax.swing.JPanel;

/**
 *
 * @author Ripper
 */
public class DrawPlayerPanel extends JPanel
{
    private ClientDomainController cdc;
    
    private int looktype;
    private Color[] colorsApplied;
    
    public DrawPlayerPanel()
    {
        looktype = -1;
    }
    
    public void setData(int lookt, Color[] colors, ClientDomainController cldoco)
    {
        looktype = lookt;
        colorsApplied = colors;
        cdc = cldoco;
    }

    @Override
    public void paintComponent(Graphics g)
    {
        g.setColor(Color.WHITE);
        g.fillRect(0, 0, this.getWidth(), this.getHeight());

        g.setColor(Color.BLACK);
        
        //TODO
        if(looktype == -1 || colorsApplied == null)
        {
            g.drawLine(0, 0, this.getWidth(), this.getHeight());
            g.drawLine(this.getWidth(), 0, 0, this.getHeight());
        }
        else
        {
            BufferedImage bi = cdc.getImage(looktype+"_idle1", colorsApplied);
            
            //g.drawImage(bi, 0, 0, this);
            g.drawImage(bi, 0, 0, getWidth(), getHeight(), this);
        }
    }
}
